Infobox/Basics
This is a basic introduction to infoboxes. A complete description of all the infobox functionality can be found in the . Some knowledge of may be necessary to design more complex infoboxes. First step The first step is to decide what contents you need in an infobox. Putting the idea down on paper or a table might help. Let's evaluate this using a case study. Case study - Batman Suppose an editor wants to create an infobox for a character, e.g. Batman. Below are the steps that can be followed. Plan Batman is a pretty popular character and it would be nice to have some basic information about him. A table below shows some of his attributes. Building an infobox Step 1 First create a page with the prefix "Template:" e.g. Template:Infobox character. Step 2 Write the following in "Template:Infobox character" and save: Name Now go to any test page, e.g. Special:MyPage/sandbox and write: That should show you the infobox on the right. Understand your first infobox Infoboxes must have a "text" that starts a section and that ends it ( XML markup). Tags A tag is a simple piece of text surrounded by "<" and ">", for example, . There are many tags that can be used to change the appearance of an infobox. The most common ones include ,, , and . How it works It's time to understand how it works. # - This is a tag indicating that this section will contain an infobox. # - This indicates that there will be a section containing some data, e.g. a name and a label. # source - This is called an attribute, and indicates where the input comes from, e.g. name from a template or . It must always be in the form of source = "text". This is case sensitive, so source = "NAME" is not the same thing as source= "name". # - This defines what label must be used for the value entered. It starts with a '' and ends with '' . Note the front-slash. # - This indicates the end of the section. # - This shows the end of the infobox. Note: The information in the infobox is shown in the order in which it is entered. Auto hiding sections When a section such as does not receive any information (e.g. source="name") it automatically hides. In some cases, the whole infobox may not appear. For example, if the example above is changed, and the following text is entered nothing will appear because there is no data to show: This will also happen if the "source" is misspelled or uses a different sentence case (e.g. upper case): Adding more to the infobox Title A title can also be added to an infobox. Instead of using use </nowiki> : Name Like before, enter this text to test your infobox in a test page: Now the infobox has a title! Images The infobox can be further improved with an image like this: Data The is the most important part of the infobox. It stores details and description of each item (or row), and there can be as many as neeeded. For example, the name of a character and the description of the field. It generally uses the following format: description For this specific case the name, alias, abilities, and affiliation will be added as shown below: Name Alias Known Abilities Affiliation In actuality, if you don't add the correct arguments into the infobox on the page you're adding it to, the associated fields won't appear, so remember to actually add the fields to the infobox on the page. The same goes if you don't type in the name of the field correctly, so if the infobox fields are not displaying correctly then this means that the fields on the page has the wrong name. Header Headers can be used to describe a specific section like "information" or "family". This is possible with just a slight change: Information Example Information Name Note that the header is different from other tags, and doesn't have a "source". Navigation One can also add content that helps people navigate using a "" element: Information This allows just about any text and can be used for footer notes, links or anything. Much like the header and the label element, the also doesn't have a "source". Bringing it all together Now all the concepts learnt above can be used together. Write this in a sandbox page: The contents of "Template:Infobox character" should look like the "box" on the left (see infobox batman) , and the infobox will look like the one the right. Information Name Alias Known abilities Affiliation Official page See also * Infobox * * es:Infobox/Básico Category:Infobox